package com.ocom.payhandle.controller;

import com.ocom.common.constant.PayHandleUrl;
import com.ocom.common.entity.typehandler.EntityCcbBusinessInfo;
import com.ocom.common.resp.Result;
import com.ocom.payhandle.service.CcbBusinessInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * ccb_business_infoController
 *
 * @author js
 * @date 2023-10-04 18:02:54
 */
@RestController
public class CcbBusinessInfoController{

        @Resource
        private CcbBusinessInfoService ccbBusinessInfoService;

        /**
         * 新增保存CcbBusinessInfo
         */
        @PostMapping(PayHandleUrl.URL_ccbzhshNewBusiness)
        public Result newBusiness(@RequestBody EntityCcbBusinessInfo ccbBusinessInfo) {
                System.out.println("ccbBusinessInfo.getComId()=="+ccbBusinessInfo.getComId());
            return ccbBusinessInfoService.newBusiness(ccbBusinessInfo.getComId(),ccbBusinessInfo);
        }

        /**
         * 修改保存CcbBusinessInfo
         */
        @PostMapping(PayHandleUrl.URL_ccbzhshUpdateBusiness)
        public Result updateBusiness(@RequestBody EntityCcbBusinessInfo ccbBusinessInfo) {
                if(ccbBusinessInfo.getPosAmount() == null){
                        ccbBusinessInfo.setPosAmount(0);
                }
            return ccbBusinessInfoService.updateBusiness(ccbBusinessInfo);
        }

}
